<?php require_once('Connections/chino.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form4")) {
  $insertSQL = sprintf("INSERT INTO clientes (id_cliente, usuario, password, nombre, apellido_pat, apellido_mat, rfc, direccion, ciudad, cpostal, telefono, correo, sexo, puntos) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['id_cliente'], "int"),
                       GetSQLValueString($_POST['usuario'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['nombre'], "text"),
                       GetSQLValueString($_POST['apellido_pat'], "text"),
                       GetSQLValueString($_POST['apellido_mat'], "text"),
                       GetSQLValueString($_POST['rfc'], "text"),
                       GetSQLValueString($_POST['direccion'], "text"),
                       GetSQLValueString($_POST['ciudad'], "text"),
                       GetSQLValueString($_POST['cpostal'], "text"),
                       GetSQLValueString($_POST['telefono'], "text"),
                       GetSQLValueString($_POST['correo'], "text"),
                       GetSQLValueString($_POST['sexo'], "text"),
                       GetSQLValueString($_POST['puntos'], "int"));

  mysql_select_db($database_chino, $chino);
  $Result1 = mysql_query($insertSQL, $chino) or die(mysql_error());

  $insertGoTo = "index.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
#apDiv1 {
	position:absolute;
	width:200px;
	height:65px;
	z-index:1;
	left: 591px;
	top: 16px;
}
body {
	background-image: url();
	background-repeat: repeat;
	background-color: #FFF;
}
#apDiv2 {
	position:absolute;
	width:987px;
	height:53px;
	z-index:1;
	left: 239px;
	top: 141px;
}
</style>
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv3 {
	position:absolute;
	width:168px;
	height:126px;
	z-index:2;
	left: 4px;
	top: -13px;
}
#apDiv4 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:3;
	left: 917px;
	top: 220px;
}
#apDiv5 {
	position:absolute;
	width:87px;
	height:24px;
	z-index:4;
	left: 926px;
	top: 312px;
}
#apDiv6 {
	position:absolute;
	width:186px;
	height:115px;
	z-index:5;
	left: 919px;
	top: 376px;
}
#apDiv7 {
	position:absolute;
	width:182px;
	height:115px;
	z-index:6;
	left: 920px;
	top: 527px;
}
#apDiv8 {
	position:absolute;
	width:189px;
	height:453px;
	z-index:7;
	left: 246px;
	top: 351px;
}
#apDiv9 {
	position:absolute;
	width:180px;
	height:109px;
	z-index:8;
	left: 248px;
	top: 228px;
}
#apDiv10 {
	position:absolute;
	width:149px;
	height:24px;
	z-index:9;
	left: 260px;
	top: 266px;
}
#apDiv11 {
	position:absolute;
	width:54px;
	height:24px;
	z-index:10;
	left: 260px;
	top: 295px;
}
#apDiv12 {
	position:absolute;
	width:184px;
	height:115px;
	z-index:11;
	left: 247px;
	top: 825px;
}
#apDiv13 {
	position:absolute;
	width:186px;
	height:115px;
	z-index:11;
	left: 246px;
	top: 810px;
}
#apDiv14 {
	position:absolute;
	width:247px;
	height:32px;
	z-index:12;
	left: 245px;
	top: 404px;
}
#apDiv15 {
	position:absolute;
	width:193px;
	height:147px;
	z-index:12;
	left: 255px;
	top: 398px;
}
#apDiv16 {
	position:absolute;
	width:176px;
	height:53px;
	z-index:13;
	left: 250px;
	top: 537px;
}
#apDiv17 {
	position:absolute;
	width:187px;
	height:49px;
	z-index:14;
	left: 246px;
	top: 596px;
}
#apDiv18 {
	position:absolute;
	width:194px;
	height:63px;
	z-index:15;
	left: 243px;
	top: 657px;
}
#apDiv19 {
	position:absolute;
	width:192px;
	height:65px;
	z-index:16;
	left: 246px;
	top: 734px;
}
#apDiv20 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:17;
	left: 583px;
	top: 249px;
}
#apDiv21 {
	position:absolute;
	width:200px;
	height:76px;
	z-index:18;
	left: 484px;
	top: 54px;
}
#apDiv22 {
	position:absolute;
	width:149px;
	height:153px;
	z-index:19;
	left: 937px;
	top: 572px;
}
#apDiv22 p img {
	text-align: center;
}
#apDiv23 {
	position:absolute;
	width:456px;
	height:245px;
	z-index:20;
	left: 456px;
	top: 310px;
	text-align: center;
}
#apDiv24 {
	position:absolute;
	width:383px;
	height:69px;
	z-index:21;
	left: 458px;
	top: 219px;
}
#apDiv25 {
	position:absolute;
	width:211px;
	height:119px;
	z-index:22;
	left: 701px;
	top: 305px;
}
#apDiv26 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:23;
	left: 440px;
	top: 303px;
}
#apDiv25 div strong {
	font-size: 14px;
}
#apDiv25 div strong {
	font-size: 18px;
}
#apDiv27 {
	position:absolute;
	width:68px;
	height:31px;
	z-index:24;
	left: 766px;
	top: 578px;
}
#apDiv28 {
	position:absolute;
	width:485px;
	height:115px;
	z-index:25;
	left: 435px;
	top: 620px;
}
#apDiv29 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:26;
	left: 435px;
	top: 1098px;
}
#apDiv30 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:27;
	left: 435px;
	top: 1337px;
}
#apDiv31 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:28;
	left: 435px;
	top: 1797px;
}
#apDiv32 {
	position:absolute;
	width:432px;
	height:175px;
	z-index:22;
	left: 458px;
	top: 288px;
}
#apDiv33 {
	position:absolute;
	width:430px;
	height:190px;
	z-index:23;
	left: 3px;
	top: 235px;
	text-align: justify;
	font-weight: bold;
}
#apDiv {
	position:absolute;
	width:383px;
	height:72px;
	z-index:21;
	left: 465px;
	top: 391px;
}
#apDiv34 {	position:absolute;
	width:200px;
	height:115px;
	z-index:23;
	left: 12px;
	top: 273px;
}
#apDiv32 strong {
	text-align: justify;
}
#apDiv35 {
	position:absolute;
	width:368px;
	height:441px;
	z-index:20;
	left: 473px;
	top: 214px;
}
</style>
<script type="text/javascript">
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_effectShake(targetElement)
{
	Spry.Effect.DoShake(targetElement);
}
</script>
</head>

<body>
<div id="apDiv3"><img src="LOGO.png" width="149" height="134" /></div>
<div id="apDiv21">
  <table width="200" border="0" align="center">
    <tr>
      <td><img src="TITULO.png" width="435" height="64" align="bottom" /></td>
    </tr>
  </table>
</div>
<p>&nbsp;</p>
<p align="center">&nbsp;</p>
<div id="apDiv2">
  <ul id="MenuBar1" class="MenuBarHorizontal">
    <li><a href="#">Home</a>    </li>
    <li><a href="#">Nosotros</a></li>
    <li><a class="MenuBarItemSubmenu" href="#">Promociones</a>
      <ul>
<li><a href="#">Accesorios</a></li>
        <li><a href="#">Componentes</a></li>
</ul>
    </li>
    <li><a href="#">Comunicaciones</a></li>
    <li><a href="#">Accesorios</a></li>
<li><a href="#">Contactos</a></li>
    <li><a href="#">Ver Carrito</a></li>
    <li><a href="#">Mi Cuenta</a></li>
  </ul>
</div>
<p align="center">&nbsp;</p>
<div id="apDiv4"><img src="carrito.jpg" width="185" height="131" /></div>
<p align="center">&nbsp; </p>
<div id="apDiv5">
  <form id="form1" name="form1" method="post" action="">
    <input type="submit" name="carrito" id="carrito" value="Ver Carrito  " />
  </form>
</div>
<div id="apDiv6"><img src="ayuda.jpg" width="187" height="134" /></div>
<div id="apDiv7"><img src="imagenes/lomasvendido.png" width="186" height="462" /></div>
<div id="apDiv8"><img src="imagenes/formasdepago.png" width="186" height="462" /></div>
<div id="apDiv9"><img src="imagenes/buscar.png" width="178" height="109" /></div>
<div id="apDiv10">
  <form id="form2" name="form2" method="post" action="">
    <label for="txtbuscar"></label>
    <input name="txtbuscar" type="text" id="txtbuscar" value="" />
  </form>
</div>
<div id="apDiv11">
  <form id="form3" name="form3" method="post" action="">
    <input type="submit" name="btnbuscar" id="btnbuscar" value="Buscar" />
  </form>
</div>
<div id="apDiv13"><img src="imagenes/1.png" width="182" height="148" /></div>
<div id="apDiv15"><img src="imagenes/paypal.jpg" width="165" height="128" onmousemove="MM_effectShake('apDiv15')" /></div>
<div id="apDiv16" onmousemove="MM_effectShake('apDiv16')"><img src="imagenes/Banamex.jpg" width="178" height="46" /></div>
<div id="apDiv17" onmousemove="MM_effectShake('apDiv17')"><img src="imagenes/santander.jpg" width="184" height="48" /></div>
<div id="apDiv18"><img src="imagenes/hsbs.jpg" width="192" height="61" onmousemove="MM_effectShake('apDiv18')" /></div>
<div id="apDiv19"><img src="imagenes/Bancomer.jpg" width="189" height="62" onmousemove="MM_effectShake('apDiv19')" /></div>
<div id="apDiv22">
  <p><img src="imagventa/antena1.jpg" width="103" height="100" align="middle" /></p>
  <p> <strong>ADAPTADOR ALFA UBDO-gt8 PARA EXTERIORES USB 802.11 /b/g 1000mW + ANTENA INTEGRADA-12dBi </strong></p>
</div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
  </script>

<p>&nbsp;</p>
<div id="apDiv35"><form action="<?php echo $editFormAction; ?>" method="post" name="form4" id="form4">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Id_cliente:</td>
      <td><input type="text" name="id_cliente" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Usuario:</td>
      <td><input type="text" name="usuario" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Password:</td>
      <td><input type="text" name="password" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Nombre:</td>
      <td><input type="text" name="nombre" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Apellido_pat:</td>
      <td><input type="text" name="apellido_pat" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Apellido_mat:</td>
      <td><input type="text" name="apellido_mat" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Rfc:</td>
      <td><input type="text" name="rfc" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Direccion:</td>
      <td><input type="text" name="direccion" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Ciudad:</td>
      <td><input type="text" name="ciudad" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Cpostal:</td>
      <td><input type="text" name="cpostal" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Telefono:</td>
      <td><input type="text" name="telefono" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Correo:</td>
      <td><input type="text" name="correo" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Insertar registro" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="form4" />
</form></div>
